package org.tgcloud.group.web.controller.manager.third;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.web.bind.annotation.*;
import org.tgcloud.group.core.APPResultMessage;
import org.tgcloud.group.core.custom.Permissions;
import org.tgcloud.group.core.session.Session;
import org.tgcloud.group.service.manager.third.MJShopThirdManageService;
import org.tgcloud.group.web.controller.manager.ManageAPPBaseController;
import org.tgcloud.group.web.controller.req.third.ThirdMJShopOrderReq;
import org.tgcloud.group.web.controller.req.third.ThirdMJShopSysLabelReq;

import java.util.Date;

/**
 * @Author: zhy
 * @Created: 2025-08-25-下午2:24
 * @Description:
 */
@Api(tags = "第三方商务订单管理相关接口")
@RestController
@RequestMapping("/manager/pc/user/third/mjShop")
@EnableAutoConfiguration
public class MJShopThirdManageController extends ManageAPPBaseController {

    @Autowired
    private MJShopThirdManageService mjShopThirdManageService;



    // trade_order_status 交易订单状态
    // trade_order_item_after_sale_status 售后状态
    @ApiOperation(value = "获取爱省鲸的系统参数")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "token", value = "token", required = true, dataType = "string")
    })
    @ResponseBody
    @RequestMapping(value = "/getThirdSysLabelList", method = RequestMethod.POST)
    public APPResultMessage getThirdSysLabelList(@ModelAttribute("session") Session session,
                                                 @RequestBody ThirdMJShopSysLabelReq req){
        return mjShopThirdManageService.getThirdSysLabelList(req.getCodes());
    }


    @Permissions("mjShopOrder:view")
    @ApiOperation(value = "获取爱省鲸的商务售卖订单列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "token", value = "token", required = true, dataType = "string")
    })
    @ResponseBody
    @RequestMapping(value = "/getBusinessOrderList", method = RequestMethod.POST)
    public APPResultMessage getBusinessOrderList(@ModelAttribute("session") Session session,
                                                 @RequestBody ThirdMJShopOrderReq req){
        return mjShopThirdManageService.getBusinessOrderList(session.getUserId(), req.getUserIds(), req.getSpuName(),
                req.getCreateStartTime(), req.getCreateEndTime(), req.getOrderStatus(), req.getRefundStatus(), req.getPageNum(), req.getPageSize());
    }


    @Permissions("mjShopOrder:view")
    @ApiOperation(value = "获取爱省鲸的商务售卖订单合计")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "token", value = "token", required = true, dataType = "string")
    })
    @ResponseBody
    @RequestMapping(value = "/getBusinessOrderCount", method = RequestMethod.POST)
    public APPResultMessage getBusinessOrderCount(@ModelAttribute("session") Session session,
                                                  @RequestBody ThirdMJShopOrderReq req){
        return mjShopThirdManageService.getBusinessOrderCount(session.getUserId(), req.getUserIds(), req.getSpuName(),
                req.getCreateStartTime(), req.getCreateEndTime(), req.getOrderStatus(), req.getRefundStatus());
    }

}
